package com.ego.order.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ego.common.util.PageUtil;
import com.ego.common.vo.BaseSearchVo;
import com.ego.common.vo.PageVo;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ego.order.dao.PaymentInfoDao;
import com.ego.order.po.PaymentInfo;
import com.ego.order.service.PaymentInfoService;

/**
 * @program: ego
 * @description 支付信息表对应实现类
 * @author KamTang
 * @date 2022-11-13 11:25:07
 */
@Service("paymentInfoService")
public class PaymentInfoServiceImpl extends ServiceImpl<PaymentInfoDao, PaymentInfo> implements PaymentInfoService {
    @Override
    public PageVo<PaymentInfo> search(BaseSearchVo search) {
        LambdaQueryWrapper<PaymentInfo> wrapper = Wrappers.lambdaQuery();
        if (StrUtil.isNotEmpty(search.getKeyword())) {
            wrapper.like(PaymentInfo::getOrderSn, search.getKeyword());
        }
        Page<PaymentInfo> page = this.baseMapper.selectPage(Page.of(search.getPageNum(), search.getPageSize()), wrapper);
        return PageUtil.toPage(page);
    }
}
